﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;

namespace FontManager
{
    /// <summary>
    /// is used for:
    /// initializing doublebuffer;
    /// Changing control style;
    /// Making the control reach to mouse click;
    /// Making control reach to TabIndex;
    /// </summary>
    public class CustomPictureBox : PictureBox
    {
        public CustomPictureBox()
        {
            this.SetStyle(ControlStyles.Selectable, true);
            this.SetStyle(ControlStyles.UserMouse, true);
            this.TabStop = true;
            this.DoubleBuffered = true;
        }

        [Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
        public new int TabIndex
        {
            get { return base.TabIndex; }
            set { base.TabIndex = value; }
        }

        [Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
        public new bool TabStop
        {
            get { return base.TabStop; }
            set { base.TabStop = value; }
        }

        protected override bool IsInputKey(Keys keyData)
        {
            if (keyData == Keys.Up || keyData == Keys.Down ||
                keyData == Keys.Left || keyData == Keys.Right) return true;
            return base.IsInputKey(keyData);
        }
    }
}
